package com.xyebank.ledger.service;

import com.xyebank.ledger.api.ILedgerApplyService;
import com.xyebank.ledger.conf.MigTaskBean;
import com.xyebank.ledger.enums.LedgerBusiTypeEnum;
import com.xyebank.ledger.enums.LedgerJobType;
import com.xyebank.ledger.service.common.MigService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;
import java.util.List;

/**
 * 
 * @author: rcl
 * @version: 1.0, 2018年8月8日
 */
@SuppressWarnings("rawtypes")
public class LedgerApplyServiceImpl implements ILedgerApplyService {
    private Logger logger	= LoggerFactory.getLogger(getClass());

    @Autowired
    private MigTaskBean migTaskBean;

    @Override
    public Integer accept( List list, String jobType) {
        MigService migService = migTaskBean.getMigService(jobType);
        if(migService == null) {
            logger.error("系统异常，为获取到{}对应的dispatcher", jobType);
            return -1;
        }

        // 调用接口进行迁移 实时接口不控制锁
        migService.migrate(list);
        return 0;
    }

    @Override
    public Integer accept(Integer fromIdx, List list, LedgerBusiTypeEnum type, LedgerJobType jobType) {
        return null;
    }

    @Override
    public Integer accept(LedgerBusiTypeEnum type) {
        return null;
    }

    @Override
    public Integer accept(LedgerBusiTypeEnum type, Date startTime, Date endTime) {
        return null;
    }

}
